package com.qfjy.homework.sunyingjian;

/**
 * @version : 1.0
 * @author:SYJ
 * @date:2022/11/10 19:33
 */
public class CompositePatternDemo {
    public static void main(String[] args){
        Employee CEO = new Employee("A", "CEO", 1000000);

        Employee headSales = new Employee("B", "Head Sales", 20000);

        Employee headMarketing = new Employee("C", "Head Marketing", 20000);

        Employee employee1 = new Employee("c1", "Marketing", 10000);
        Employee employee2 = new Employee("c2", "Marketing", 10000);

        Employee headEmployee1 = new Employee("b1", "Sales", 10000);
        Employee headEmployee2 = new Employee("b2", "Sales", 10000);

        CEO.add(headSales);
        CEO.add(headMarketing);

        headSales.add(headEmployee1);
        headSales.add(headEmployee2);

        headMarketing.add(employee1);
        headMarketing.add(employee2);


        System.out.println(CEO);
        for (Employee headEmployee : CEO.getSubordinates()) {
            System.out.println(headEmployee);
            for (Employee employee : headEmployee.getSubordinates()) {
                System.out.println(employee);
            }
        }
    }
}
